package com.zlop.chain;

import java.util.ArrayList;
import java.util.List;

public class Container {
	
	private static List<AbstractHandle> handleList = new ArrayList<>();
	
	public static void execute(){
		int size = handleList.size();
		if(size > 0){
			for(int i=0; i<size; i++){
				if(i != size - 1){
					handleList.get(i).setHandle(handleList.get(i+1));
				}
			}
			handleList.get(0).operaor();
		}
	}
	
	public static boolean add(AbstractHandle handle){
		return handleList.add(handle);
	}

}
